pdf.text "Transportes WM", :size => 20, :style => :bold

items = @transportes.map do |transporte|

		ended_at = transporte.ended_at.nil? ? nil : transporte.ended_at.strftime('%d/%m/%y %H:%M').to_s
		created_at = transporte.created_at.nil? ? nil : transporte.created_at.strftime('%d/%m/%y %H:%M').to_s
		updated_at = transporte.updated_at.nil? ? nil : transporte.updated_at.strftime('%d/%m/%y %H:%M').to_s
		released_at = transporte.released_at.nil? ? nil : transporte.released_at.strftime('%d/%m/%y %H:%M').to_s	
		etiqueta = transporte.etiqueta.nil? ? " - " : transporte.etiqueta == true ? "OK" : " - "
		carro = transporte.carro.nil? ? " - " : transporte.carro == true ? "OK" : " - "
		
		depositos = ""
        transporte.armazenamentos.each do |arm|
            depositos += "#{arm.deposito.nome}-"
        end		
		
	[	
		#transporte.id,	
		depositos,
		transporte.ndt,
		transporte.transportadora.nome,		
		transporte.itinerario,
		transporte.pares,
		transporte.cxs,
		transporte.tipo.sigla,
		transporte.m,
		transporte.peso,
		transporte.status.sigla,		
		ended_at,
		created_at,
		transporte.obs_trans,
		etiqueta,
		carro
	]
end

pdf.table items, :border_style => :underline_header, 
				 :row_colors => ["FFFFFF", "DDDDDD"],
				 :font_size => 7,
				 :position => :left,
				 :width => 770,						 
				 :headers => ["Depositos", "Ndt", "Transp", "Itinerario", "Pares", "Cxs", "Tipo", "m3", "Peso","Status", "Faturado", "Criado", "Obs", "Etq", "Carro"],
				 :align => { 0 => :left,1 => :left,2 => :left,3 => :left,4 => :left,5 => :left,6 => :left,7 => :left,8 => :left,9 => :left,10 => :left,11 => :left,12 => :left,13 => :left,14 => :left},
				 :align_headers => { 0 => :center,1 => :center,2 => :center,3 => :center,4 => :center,5 => :center,6 => :center,7 => :center,8 => :center,9 => :center,10 => :center,11 => :center,12 => :center,13 => :center,14 => :center},
				 :widths => {0 => 300},
     			 :header_color => '626262',
				 :header_text_color  => "ffffff",
				 :widths => { 0 => 2000 }			 
				 
	
def nome_depositos(transporte)
	nome = ""
	Transporte.find(transporte).armazenamentos.each do |arm|
		deposito = arm.deposito
		nome += "#{deposito.nome}"
	end
	return nome
end					 